package com.example.nftapp.frg.market;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.nftapp.R;
import com.example.nftapp.adapter.MarketProductAllAdapter;
import com.example.nftapp.beans.Product;

import java.util.ArrayList;
import java.util.List;

public class MarketFragment_QB extends Fragment {
    RecyclerView markRc;
    List<Product> products;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_market_qb, container, false);
        initData();
        initId(view);
        initView(view);
        return view;
    }

    private void initData() {
        products = new ArrayList<>();
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 99.90f, 3.5601f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, -0.2603f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, 2.5603f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, -0.2603f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, 2.5603f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, -0.2603f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, 2.5603f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, -0.2603f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, 2.5603f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, -0.2603f));
        products.add(new Product(R.mipmap.mark_list_1, "藏品展示名称", 1999.90f, 2.5603f));
    }

    private void initId(View view) {
        markRc = view.findViewById(R.id.market_rc);
    }

    private void initView(View view) {
        markRc.setAdapter(new MarketProductAllAdapter(products));
        markRc.setLayoutManager(new LinearLayoutManager(view.getContext()));
    }
}